package com.exp.controller;

import com.exp.dao.AdminMapper;
import com.exp.dao.HotBusinessMapper;
import com.exp.model.Admin;
import com.exp.model.HotBusiness;
import com.exp.service.AdminService;
import com.exp.service.HotBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 Created by guojianyu on 2016/1/24.
 */
@Controller
@RequestMapping("/hotBusiness")
public class HotBusinessController {
    @Autowired
    private HotBusinessService hotBusinessService;
    /*页面*/
    @RequestMapping("/view")
    public String view() {
        return "hotBusiness/hotBusinessList";
    }
    /*获取列表*/
    @RequestMapping("/list")
    @ResponseBody
    public List<HotBusiness> list(@RequestParam Map<String, Object> params) {
        List<HotBusiness> hotBusiness = hotBusinessService.getList(params);
        return hotBusiness;
    }
    /*删除*/
    @RequestMapping("/delete/{id}")
    @ResponseBody
    public boolean delete(@PathVariable Integer id) {
        hotBusinessService.delete(id);
        return true;
    }
    /*增加*/
    @RequestMapping("/add")
    @ResponseBody
    public boolean add(HotBusiness hotBusiness){
        hotBusinessService.add(hotBusiness);
        return true;

    }
    /*修改*/
    @RequestMapping("/update")
    @ResponseBody
    public boolean update(HotBusiness hotBusiness){
        if (hotBusiness.getId() != null) {
            hotBusinessService.update(hotBusiness);
        }
        return true;
    }
}

